import Vue from 'vue'
import App from './App.vue'

import store from './store'

Vue.config.productionTip = false
let resizeTimeout = null;
let app = null;

let resetAppSize = () => {
  if (resizeTimeout) {
    clearTimeout(resizeTimeout);
}
resizeTimeout = setTimeout(() => {
    let width = document.documentElement.clientWidth;
    let height = document.documentElement.clientHeight;
    
    let appSize = {
      width: width,
      height: height
  }
  //console.log(appSize, new Date().getTime())
  app && app.$store.dispatch("app/setAppSize", appSize)
}, 200);
}

window && window.addEventListener("resize", () => {
  resetAppSize();
});

setTimeout(()=>{
  resetAppSize();
}, 200)

app = new Vue({
  store,
  render: h => h(App),
}).$mount('#app')
